import 'dart:async';
import 'package:js/js.dart';

@JS()
class WebApp {
  external static invoke(void Function(dynamic res) success,
      void Function(dynamic res) failure);

  static Future invokeFuture() {
    Completer completer = Completer();
    invoke((res) {
      print('successFuture');
      print(res);
      completer.complete(res);
    }, (err) {
      print('failedFuture');
      print(err);
      completer.completeError(err);
    });
    return completer.future;
  }
}